load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "datum",
    srcs = [
        "create.go",
        "create_stream.go",
        "datum.go",
        "datum.pb.go",
        "datum.pb.validate.go",
        "datum.pb.zap.go",
        "iterator.go",
        "option.go",
        "util.go",
        "worker.go",
    ],
    importpath = "github.com/pachyderm/pachyderm/v2/src/server/worker/datum",
    visibility = ["//visibility:public"],
    deps = [
        "//src/auth",
        "//src/internal/client",
        "//src/internal/errors",
        "//src/internal/errutil",
        "//src/internal/grpcutil",
        "//src/internal/log",
        "//src/internal/miscutil",
        "//src/internal/pctx",
        "//src/internal/pfsfile",
        "//src/internal/pfssync",
        "//src/internal/protoutil",
        "//src/internal/storage/renew",
        "//src/internal/stream",
        "//src/internal/tarutil",
        "//src/internal/task",
        "//src/internal/uuid",
        "//src/pfs",
        "//src/pps",
        "//src/server/pfs",
        "//src/server/pfs/server",
        "//src/server/worker/common",
        "//src/server/worker/stats",
        "//src/storage",
        "@com_github_pachyderm_ohmyglob//:ohmyglob",
        "@org_golang_google_grpc//:grpc",
        "@org_golang_google_protobuf//encoding/protojson",
        "@org_golang_google_protobuf//proto",
        "@org_golang_google_protobuf//reflect/protoreflect",
        "@org_golang_google_protobuf//runtime/protoimpl",
        "@org_golang_google_protobuf//types/known/anypb",
        "@org_golang_google_protobuf//types/known/durationpb",
        "@org_golang_x_sync//errgroup",
        "@org_uber_go_zap//:zap",
        "@org_uber_go_zap//zapcore",
    ],
)

go_test(
    name = "datum_test",
    size = "small",
    srcs = [
        "datum_test.go",
        "iterator_internal_test.go",
        "iterator_test.go",
        "util_test.go",
    ],
    embed = [":datum"],
    pure = "on",
    shard_count = 4,
    deps = [
        "//src/internal/client",
        "//src/internal/dockertestenv",
        "//src/internal/errors",
        "//src/internal/errutil",
        "//src/internal/pctx",
        "//src/internal/require",
        "//src/internal/tarutil",
        "//src/internal/task",
        "//src/internal/testpachd/realenv",
        "//src/internal/uuid",
        "//src/pfs",
        "//src/pps",
        "@com_github_google_go_cmp//cmp",
        "@com_github_google_go_cmp//cmp/cmpopts",
        "@org_golang_google_grpc//:grpc",
        "@org_golang_google_protobuf//testing/protocmp",
        "@org_golang_google_protobuf//types/known/anypb",
        "@org_golang_google_protobuf//types/known/wrapperspb",
    ],
)

filegroup(
    name = "protos",
    srcs = glob(["*.proto"]),
    visibility = ["//src:__pkg__"],
)
